<?php

namespace App\ModelFilters;


class ChannelGroupFilter extends BaseFilter
{
    /**
    * Related Models that have ModelFilters as well as the method on the ModelFilter
    * As [relationMethod => [input_key1, input_key2]].
    *
    * @var array
    */
    public $relations = [
    ];


    public function title($value){
        return $this->where('title', $value);
    }
    public function sort_type($value){
        return $this->where('sort_type', $value);
    }

    public function channel_id($value){
        return $this->related('items', 'channel_id', '=', $value);
    }
    public function channel_ids($value){
//        return $this->related('items', 'channel_id', 'IN', $value);
        return $this->related('items', function($query) use ($value) {
            return $query->whereIn('channel_id', $value);
        });
    }
}
